var movedown={
    data(){
        return {                            
        }
    },
    methods:{
        cmd_movedown_do:function(){
            if(this.pages[this.activePageIndex].items.filter(item=>{return item.selected}).length != 1) return;            
            var item = JSON.parse(JSON.stringify(this.pages[this.activePageIndex].items.filter(e=>e.selected)[0]));
            if(item.idx === 0){
                console.warn('元素已在最后边,无法操作')
                return;
            }
            this.cmdo('records');      
            var elements=JSON.parse(JSON.stringify(this.pages[this.activePageIndex].items));
           
            //交换向元素到前一位
            elements[item.idx]=elements[item.idx-1];
            elements[item.idx-1]=item;
            elements[item.idx-1].idx=item.idx-1;

            this.itemsInstanceUnChkSel(this.activePageIndex);
			this.clearSVG();
				
			this.pages[this.activePageIndex].items=[];							
			if(elements && elements.length>0){				
				for(var i=0;i<elements.length;i++){                    					
					this.renderItem(this.pages[this.activePageIndex],elements[i]);
				}				
            }
            
            this.itemInstanceChecked(item);
        },
        cmd_movedown_active:function(selectCount){
            this.cmdActive['movedown']=selectCount===1 
                && this.pages[this.activePageIndex].items.filter(item=>{return item.selected})[0].idx !== 0;
        }
    }
}

export default movedown;
